package com.huangliusong.order.controller;

import com.huangliusong.order.client.ProductClient;
import com.huangliusong.order.dataobject.ProductInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

/**
 * @author huangliusong
 * @since 2018/10/26
 * {@link }
 */
@RestController
@Slf4j
public class ClientController  {


    @Autowired(required = false)
    private ProductClient productClient;

    @GetMapping("/getProductMessage")
    public String getProductMsg(){
       String response=productClient.productMsg();
        log.info("response={}",response);
        System.out.println("我正常输出了");
        return response;
    }

    @GetMapping("/getProductList")
    public String getProductList(){
        List<ProductInfo> productInfoList=productClient
                .listForOrder(Arrays.asList("164103465734242707"));
        log.info("response={}",productInfoList);
        return ":ok";
    }
}
